package org.learn.intermediate;
//enum 类常用方法
//name返回对象名,ordina返回对象编号，values返回所有常量
//valuesOf将字符串转为枚举对象，要求字符串必须为已有常量名，否则转换异常
//compareTo比较两个枚举对象的编号
public class Enumeration {
    public static void main(String[] args) {
        System.out.println(Season.SPRINT);
        System.out.println(Season.SUMMER);


    }
}
enum Season {
    SPRINT("春天","温暖"),
    SUMMER("夏天","炎热");


    private String name;
    private String desc;

    private Season(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }




    public void setName(String name) {
        this.name = name;
    }


    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String toString() {
        return "Season{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}